﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Office.Interop.Word;
using Microsoft.Office.Core;
//using org.apache.poi.hpsf.extractor;
//using org.apache.poi.
namespace LWrap.FileParsers
{
    public class WordFileParser:FileParserBase
    {
        public override string ExtractText(string filePath)
        {
            ApplicationClass wordApp = new ApplicationClass();
            object file = filePath;
            object nullobj = System.Reflection.Missing.Value;
            Document doc = wordApp.Documents.Open(ref file, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj, ref nullobj);
            string textVal = doc.Content.Text;
            doc.Close(ref nullobj, ref nullobj, ref nullobj);
            return textVal;
        }
    }
}
